﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DTC.Database;

namespace DTC.Popups
{
    /// <summary>
    /// Interaction logic for VisitsHistory.xaml
    /// </summary>
    public partial class VisitsHistoryPopup : Window
    {
        public VisitsHistoryPopup()
        {
            InitializeComponent();
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            patient = new DTCPatient();
            MainGrid.DataContext = patient;
        }
        private List<DTCVisit> visits;
        private DTCPatient patient;

        public DTCPatient Patient
        {
            get
            {
                return patient;
            }
            set
            {
                if (patient != value)
                {
                    patient = value;
                    MainGrid.DataContext = patient;
                    visits = App.DBI.GetVisitsByPatient(patient);
                    VisitsListBox.ItemsSource = visits;
                }
            }
        }
    }
}
